package bonus 
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import field.GamePanel;
	/**
	 * ...
	 * @author 
	 */
	public class Bonus extends MovieClip
	{
		protected var main: Main = null;
		
		public function set selected(value: Boolean):void {
			if (main.currentBonus != null)
				if (main.currentBonus != this)
					main.currentBonus.selected = false;
			if (value) {
				main.currentBonus = this;
				gotoAndPlay("Selected");
			}else {
				main.currentBonus = null;
				gotoAndPlay ("Normal");
			}
		}
		
		public function get selected(): Boolean{
			return currentLabel == "Selected";
		}
		
		public function Bonus() {
			addEventListener(MouseEvent.CLICK, onClick);
			addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		
		function onAddedToStage(e: Event):void {
			main = Main(root);
			buttonMode = true;
		}
		public function onClick(e: MouseEvent) {
			selected = !selected;
		}
		
		public function apply(): void {
			selected = false;
			main.votes.votes -= 1;
		}
		
		public function select(tileX: Number, tileY: Number): void {
			
		}
		
	}

}